package com.aefan.strategy;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * @Author: jxl
 * @Date: 2021/10/10 下午3:48
 */
public class Test {

    public static void main(String[] args) throws InterruptedException {
        String exp = "2*8";
        ICalculator iCalculator = new Multiply();
        int result = iCalculator.calculate(exp);

        System.out.println(result);

        Map<String,Integer> map = new HashMap<>();
        map.put("a",1);
        map.put("b",2);
        map.put("c",3);

        for(String key:map.keySet()) {
//            Thread.sleep(1000);
            System.out.println("key："+key+" value："+map.get(key));
        }
        System.out.println("---------------------");
        for (Map.Entry<String,Integer> entry:map.entrySet()) {
            System.out.println("key："+entry.getKey()+" value："+entry.getValue());
        }
        System.out.println("---------------------------");
        Iterator<Map.Entry<String,Integer>> iterator = map.entrySet().iterator();
        while (iterator.hasNext()){
            Map.Entry<String,Integer> entry = iterator.next();
            System.out.println("key："+entry.getKey()+" value："+entry.getValue());
        }
        

    }

}
